package com.jing.controller;

import com.jing.common.core.domain.R;
import com.jing.common.core.web.controller.BaseController;
import com.jing.common.core.web.page.TableDataInfo;
import com.jing.domain.Vo.ProducAttributetCategoryVO;

import com.jing.service.ProducAttributetCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：wp
 * @Package：com.jing.controller
 * @Project：jing
 * @name：ProductCategoryController
 * @Date：2024/5/23 19:03
 */
@RestController
@RequestMapping("productcategory")
@Api(tags = "分类模块")
@Slf4j
public class ProductCategoryController extends BaseController {
    @Autowired
    private ProducAttributetCategoryService productCategoryService;
    @ApiOperation( "品牌类型" )
    @GetMapping("list")
    public TableDataInfo productcategorylist(@RequestParam(required = false) Integer pageNum , @RequestParam(required = false) Integer pageSize){
        log.info ( "==============参数是{},{}============",pageNum,pageSize);
        startPage ();

        List<ProducAttributetCategoryVO> data = productCategoryService.list ();
        TableDataInfo dataTable = getDataTable ( data );
        return dataTable;
    }
    @ApiOperation ( "品牌分类添加" )
    @GetMapping("add/{name}")
    public R productcategoryadd(@PathVariable String name){
        log.info ( "==============参数是{}============",name);
        productCategoryService.add(name);
        return R.ok ();
    }
    @ApiOperation ( "品牌分类修改" )
    @PostMapping("updata")
    public R productcategoryupdate(@RequestBody ProducAttributetCategoryVO pms){
        log.info ( "==============参数是{}============",pms);
        productCategoryService.up(pms);
        return R.ok ();
    }
    @ApiOperation ( "品牌分类删除" )
    @GetMapping("del/{id}")
    public R productcategorydel(@PathVariable Integer id){
        log.info ( "==============参数是{}============",id);
        productCategoryService.del(id);
        return R.ok ();
    }
}
